home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
graphics
/
circuit_macros
/
README
< prev
Wrap
Text File
|
1994-03-13
|
3KB
|
72 lines
Circuit_macros version 1.0 (I suppose)
This is a set of macros for drawing circuits, operational amplifiers,
and some block diagrams I have had occasion to require, for inclusion
in [La]TeX documents printed with a postscript printer. The advantages
and disadvantages of such a system are those of TeX itself: ordinary
character input, non-wysiwyg. I use xfig for other kinds of diagrams
but find a drawing language useful for graphics containing regularity
such as do circuit diagrams.
Required software: m4, gpic, tex, dvips
The base graphics language is pic, which is simple to use but
limited in power. On unix one can use gpic -t, but several years ago
in the course of writing a book I took a few days off to write a pic
interpreter that output latex picture objects, and which more recently
has been changed to output pstricks objects, my personal preference
because of the better quality of resulting graphics and greater
control. I preferred the m4 macro processor to pic macros, and
therefore m4 (a free version of which appeared recently) is required
here.
Each diagram appears between .PS and .PE lines, with an optional
dimension after .PS:
.PS 0.8
source(up_ 0.5); llabel(-,v_s,+)
{arrow right linewid/2; "$i_R$" at last arrow.end above}
line right
resistor(down_ 0.5); llabel(+,R,-)
line left
.PE
This file, bug.m4, say, is then processed as shown:
m4 libcct.m4 gpic.m4 bug.m4 | gpic -t > bug.tex
where gpic.m4 is a file containing something like:
undefine(`pstricks')define(`gpic',`defined')
The file bug.tex is then included in the LaTeX document in the usual way,
and the .dvi file printed using dvips.
Installation:
Put the lib*.m4 files in your $HOME/lib directory. Change the
definition of HOMELIB_ in libcct.m4 and darrow.m4.
Examples:
Cd to the examples directory. Change the definition of LIBCCT
in Makefile. Type `make'.
Manuals. See any pic manual or the documentation that comes with gpic,
which is part of the Gnu groff distribution.
Comments: Pic has a very useful concept of the current point and current
direction, the latter unfortunately limited to up, down, left, right.
These macros need to know the current direction so down should be written
as down_, etc. The Point_ or rpoint_ macros set the current direction
cosines x_, y_ which are used to draw complex objects in any orientation.
Thus `Point(-30); resistor' draws a resistor along a line with slope -30
degrees. `rpoint_(to Z)' sets the current direction cosines to point to Z.
The default for all objects is `right_.' The circuit element
macros all may be invoked with arguments. Thus `capacitor(from A to B)'
draws a capacitor from A to B (of course). The arguments may be any
valid arguments following `line invis' in pic. Real documentation
will have to wait another day. See the examples. Inevitably a set of
macros such as this will be modified to suit individual use and taste.
Dwight Aplevich
aplevich@uwaterloo.ca